package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id查询套餐id列表
     * @param dishIds
     * @return
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 新增套餐菜品
     * @param setmealDishes
     */
    void insertSetmealDishBatch(List<SetmealDish> setmealDishes);

    /**
     * 删除关联套餐菜品
     * @param setmealIds
     */
    void deleteSetmealDishBatch(List<Long> setmealIds);

    /**
     * 根据套餐id查询套餐菜品
     * @param id
     * @return
     */
    List<SetmealDish> getSetmealDishBySetmealId(Long id);

    /**
     * 根据套餐id删除关联菜品
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteSetmealDishBySetmealId(Long setmealId);
}
